﻿jQuery(document).ready(function () {
    jQuery('#scoreMapper div.scoreMapperFieldPrevalue input.value').change(function () {
        storeScoreMapperValues();
    });
})

function storeScoreMapperValues() {
    var vals = '';

    jQuery('div.scoreMapperFieldPrevalue', jQuery('#scoreMapper')).each(function () {
        var id = jQuery('input.key', this).val();
        if (id != '') {
            var score = jQuery('input.value', this).val();
            if (score == '') { score = 0; }
            vals += id + ',' + score + ';';
        }
    });

    jQuery('#scoreMapperValues').val(vals);
}